﻿var $ = $telerik.$;
var uploadsInProgress = 0;

function onFileSelected(sender, args) {
    if (!uploadsInProgress)
        $("#btnSave").attr("disabled", "disabled");

    uploadsInProgress++;
}

function onFileUploaded(sender, args) {
    decrementUploadsInProgress();
}

function onUploadFailed(sender, args) {
    decrementUploadsInProgress();
}

function decrementUploadsInProgress() {
    uploadsInProgress--;

    if (!uploadsInProgress)
        $("#btnSave").removeAttr("disabled");
}
